package com.zy.dp.observer.example2;

import java.util.ArrayList;
import java.util.List;



public class Subject
{
	private List<Observer> readers = new ArrayList<Observer>();

	public void attach(Observer observer)

	{
		readers.add(observer);

	}

	public void detach(Observer obersver)
	{

		readers.remove(obersver);
	}

	protected void notifyObservers()
	{

		for (Observer observer : readers)
		{
			observer.update(this);

		}

	}
}
